package com.example.myapplication.module1.adapter

import android.content.Context
import android.view.LayoutInflater
import android.view.ViewGroup
import com.example.myapplication.databinding.ItemWorknoticeDetailBinding
import com.example.myapplication.entity.WorkNoticeDetailBean
import com.example.mylibrary.adapter.BaseRecyclerAdapter

class WorkNoticeDetailAdapter(context: Context) :
    BaseRecyclerAdapter<ItemWorknoticeDetailBinding>(context) {

    companion object {
        const val NBGG = 101
        const val KHSR = 102
        const val YGSR = 103
        const val SSXM = 104
        const val QDTX = 105
        const val YYBF = 106
        const val SHHF = 107
        const val CQYS = 108
        const val CQYF = 109
        const val CQDD = 110
        const val GQSP = 111
        const val KCBJ = 112
        const val ZERO = 113
        const val PEBJ = 114
        const val FPTX = 115
        const val MYSH = 116
        const val XYED = 117
        const val HTTX = 118
        const val JHTX = 119
        const val ZJTX = 120
        const val SBTX = 121
        const val ZLZQ = 122
        const val WXTX = 123
        const val AZTX = 124
        const val ZLXF = 125
    }

    var workNoticeDetailBeans: MutableList<WorkNoticeDetailBean>? = mutableListOf()
        set(value) {
            field = value
            notifyDataSetChanged()
        }

    override fun getBinding(
        inflater: LayoutInflater,
        parent: ViewGroup,
        viewType: Int
    ): ItemWorknoticeDetailBinding {
        return ItemWorknoticeDetailBinding.inflate(inflater, parent, false)
    }

    override fun bindHolder(holder: BaseViewHolder, position: Int) {
        val workNoticeDetailBean = workNoticeDetailBeans?.get(position)
        viewBinding.tvDate.text = workNoticeDetailBean?.title?.trim()
        viewBinding.tvName.text = workNoticeDetailBean?.cname?.trim()
    }

    override fun getItemCount(): Int {
        return workNoticeDetailBeans?.size ?: 0
    }
}
